package com.thinkingstar.iads.common.utils;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
  * @ClassName: SystemProperties 
  * @Description: (获取系统级配置信息) 
  * @author int_java_se@163.com 
  * @date 2016年10月17日 下午9:35:42
 */
public class InitSystemProperties {
	
	private static final Logger LOGGER = LoggerFactory.getLogger(InitSystemProperties.class);
	
	private static Locale locale =  new Locale("zh", "CN"); 
	private static final ResourceBundle bundle = java.util.ResourceBundle.getBundle("htmlTemplate",locale);
	private static final String _true = "true";

	/**
	 * 获取项目部署根目录 opt / media
	 * */
	public static String getProjectPath(){
		return InitSystemProperties.get("project.path");
	}



	/**
	 * 获取单点登录系统url
	 * */
	public static String getDddlUrl(){
		return InitSystemProperties.get("dddlUrl");
	}

	/**
	 * 通过键获取值
	 * @param key
	 * @return
	 */
	public static final String get(String key) {
		return bundle.getString(key);
	}
	

	/**
	 * 获取非结构化数据文档
	 * @return
	 */
	public static String getHtmlTemplate(){
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.append(InitSystemProperties.get("no_btn")).append(InitSystemProperties.get("btn"))
		.append(InitSystemProperties.get("textarea")).append(InitSystemProperties.get("content"))
		.append(InitSystemProperties.get("submit_btn")).append(InitSystemProperties.get("id"))
		.append(InitSystemProperties.get("project_id")).append(InitSystemProperties.get("word_div"))
		.append(InitSystemProperties.get("pdf_div")).append(InitSystemProperties.get("excel_div"))
		.append(InitSystemProperties.get("dwg_div")).append(InitSystemProperties.get("image"))
		.append(InitSystemProperties.get("select_div")).append(InitSystemProperties.get("checkbox_div"))
		.append(InitSystemProperties.get("radio_div")).append(InitSystemProperties.get("inline_text_div"))
		.append(InitSystemProperties.get("inline_textarea_div")).append(InitSystemProperties.get("image_div"));
		return stringBuilder.toString();
	}
	
	/**
	 * 获取系统根目录
	 * @return
	 */
	public static String getSystemPath(){
		return InitSystemProperties.get("web.system.path");
	}
	
	/**
	 * 获取数据源信息
	 */
	public static String getTableSchema(){
		return InitSystemProperties.get("table_schema");
	}
	
	//获取jar发布路径
	public static String getJarFilePath(){
		return InitSystemProperties.get("web.jar.path");
	}
	
	/**
	 * 获取系统文件根目录
	 * @return
	 */
	public static String getSystemFilePath(){
		return InitSystemProperties.get("web.file.path");
	}
	
	/**
	 * 获取业务根目录
	 * @return
	 */
	public static String getBusinessPath(){
		return InitSystemProperties.get("web.business.path");
	}
	
	/**
	 * 获取运维根目录
	 * @return
	 */
	public static String getOperationsPath(){
		return InitSystemProperties.get("web.operations.path");
	}
	
	/**
	 * 获取运维SQL文件根目录
	 * @return
	 */
	public static String getOperationSqlPath(){
		return InitSystemProperties.get("web.operations.sql.path");
	}
	
	/**
	 * 获取运维文件根目录
	 * @return
	 */
	public static String getOperationFilePath(){
		return InitSystemProperties.get("web.operations.file.path");
	}
	
	/**
	 * 获取运维日志根目录
	 * @return
	 */
	public static String getOperationLogPath(){
		return InitSystemProperties.get("web.operations.log.path");
	}
	
	/**
	 * 获取运维持久化根目录
	 * @return
	 */
	public static String getOperationPersistencePath(){
		return InitSystemProperties.get("web.operations.persistence.path");
	}

	/**
	 *   获取预览服务的ip
	 * @return
	 */
	public static String getPreviewServerIP(){
		return InitSystemProperties.get("preview.server.ip");
	}

	/**
	 *  获取预览服务port
	 * @return
	 */
	public static String getPreviewServerPort(){
		return InitSystemProperties.get("preview.server.port");
	}
	
	/**
	 *  获取预览服务port
	 * @return
	 */
	public static String getPreviewCadServerPort(){
		return InitSystemProperties.get("preview.cad.server.port");
	}
	
	/**
	 *   获取预览Cad服务的ip
	 * @return
	 */
	public static String getPreviewCadServerIP(){
		return InitSystemProperties.get("preview.cad.server.ip");
	}

}
